package com.wbt.bambootown.mvp.presenter;


import com.wbt.bambootown.mvp.contract.LoginContract;
import com.wbt.bambootown.mvp.contract.ReplacePwdContract;
import com.wbt.bambootown.mvp.frame.ActivityPresenter;
import com.wbt.bambootown.mvp.model.LoginModel;
import com.wbt.bambootown.mvp.model.ReplacePwdModel;
import com.wbt.bambootown.rx.FilterSubscriber;

public class ReplacePwdPresenter extends ActivityPresenter<ReplacePwdModel,ReplacePwdContract.View> implements ReplacePwdContract.Presenter{
    public static final String TAG = "ReplacePwdPresenter";

    @Override
    public void updatePassword(String uid, String oldPwd, String newPwd) {
        addSubscriptionForUser(getModel().updatePassword(uid, oldPwd, newPwd), new FilterSubscriber() {
            @Override
            public void onError(int errorCode, String errorMsg) {
                getView().showError(errorMsg);
            }

            @Override
            public void onNext(Object o) {
                getView().showReplaceSuccess();
            }
        });
    }
}
